package com.p2p.base.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.p2p.base.dao.BaseMapper;

/**
 * @author ruiqi
 *
 */
public interface SequenceDao extends BaseMapper{

	//select ... for update
	@Select("select current_value from p2p_sequence where name = #{name} for update")
	public Long getCurrentValue(String name);
	
	@Update("update p2p_sequence set current_value = current_value + 1 where name = #{name} ")
	public Long update(String name);
	
	@Update("update p2p_sequence set current_value =  1 where name = #{name} ")
	public void reset(String name);
}
